package com.czxy.dao;

import com.czxy.domain.User;
import com.czxy.domain.UserVo;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zhangmengxiang1@itcast.cn
 * @version 1.0
 * @date 2020/1/30
 */
@org.apache.ibatis.annotations.Mapper
public interface UserDao extends Mapper<User> {
    @Select("select * from user_management")
    @Results({
            @Result(property = "typeid",column = "typeid"),
            @Result(property = "certificateType",column = "typeid",one = @One(select = "com.czxy.dao.CertificateTypeDao.selectByPrimaryKey"))
    })
    List<User> findAllUserForpage(UserVo userVo);

    @Select("select * from user_management where uid = #{uid}")
    @Results({
            @Result(property = "typeid",column = "typeid"),
            @Result(property = "certificateType",column = "typeid",one = @One(select = "com.czxy.dao.CertificateTypeDao.selectByPrimaryKey"))
    })
    User findOneUserByuid(@Param("uid") Integer uid);
}
